﻿#region License statement
// NJamb, a specification and delta-specification DSL
// Copyright (c) 2010-2011, Mark Knell
// Published under the MIT License; all other rights reserved
#endregion

#region using...
using System;
using System.Collections.Generic;
using NJamb.Parser.SpecificationBuilders.SubjectHas.AbstractEnumerable;
using NJamb.Specifications;
using Stile.Patterns.SelfDescribingPredicates;
using Stile.Patterns.SelfDescribingPredicates.Evaluators;
#endregion

namespace NJamb.Parser.SpecificationBuilders.SubjectHas.Extensions
{
    public static class HasExtensions
    {
        public static TSpecifies MinOf<TSubject, TItem, TSpecifies>(
            this IEnumerableHas<TSubject, TItem, TSpecifies> collaboratingHas, TItem min)
            where TSubject : class, IEnumerable<TItem> where TItem : IComparable<TItem>
            where TSpecifies : class, ISpecification<TSubject>
        {
            Evaluator<TSubject, TItem> evaluator = ExpectEnumerable<TSubject, TItem>.MinOf(min);
            return collaboratingHas.Xray.SpecificationBuilder.Specify(evaluator);
        }
    }
}
